<template>
  <div class="app-container">
    <el-form :model="queryParams" ref="queryForm" :inline="true" label-width="68px">
      <el-form-item label="所属网格" prop="ehGridId">
        <el-input
          v-model="queryParams.ehGridId"
          placeholder="请输入所属网格"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="手机号" prop="ehvPhone">
        <el-input
          v-model="queryParams.ehvPhone"
          placeholder="请输入手机号"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item label="身份证" prop="ehvIdNumber">
        <el-input
          v-model="queryParams.ehvIdNumber"
          placeholder="请输入身份证"
          clearable
          size="small"
          @keyup.enter.native="handleQuery"
        />
      </el-form-item>
      <el-form-item>
        <el-button type="primary" icon="el-icon-search" size="mini" @click="handleQuery">搜索</el-button>
        <el-button icon="el-icon-refresh" size="mini" @click="resetQuery">重置</el-button>
      </el-form-item>
    </el-form>

    <el-table
      v-loading="loading"
      :data="ehUserVolunteerList"
      @selection-change="handleSelectionChange"
    >
      <el-table-column type="selection" width="55" align="center" />
      <el-table-column prop="ehvId" header-align="center" align="center" label="主键编号"></el-table-column>
      <el-table-column prop="ehvName" header-align="center" align="center" label="当前会员"></el-table-column>
      <el-table-column prop="ehGridName" header-align="center" align="center" label="所属网格"></el-table-column>
      <el-table-column prop="ehvStreet" header-align="center" align="center" label="所在街道"></el-table-column>
      <el-table-column prop="ehvPhone" header-align="center" align="center" label="手机号"></el-table-column>
      <el-table-column prop="ehvIdNumber" header-align="center" align="center" label="身份证"></el-table-column>
      <el-table-column prop="ehvAddress" header-align="center" align="center" label="详细地址"></el-table-column>
      <el-table-column prop="ehvQuarters" header-align="center" align="center" label="所在小区"></el-table-column>
      <el-table-column prop="ehvCreateTime" header-align="center" align="center" label="申请时间"></el-table-column>
      <el-table-column prop="ehvAuthStatus" header-align="center" align="center" label="状态"></el-table-column>
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button size="mini" type="text" icon="el-icon-info" @click="handleInfo(scope.row)">查看</el-button>
        </template>
      </el-table-column>
    </el-table>
    <pagination
      v-show="total>0"
      :total="total"
      :page.sync="queryParams.pageNum"
      :limit.sync="queryParams.pageSize"
      @pagination="getList"
    />
    <!-- 查看信息 -->
    <el-dialog :title="title" :visible.sync="open" width="800px" append-to-body>
      <el-form ref="form" :model="form" :rules="rules" label-width="130px">
        <el-row>
          <!-- <el-col :span="12">
            <el-form-item label="主键编号：" prop="ehvId">{{form.ehvId}}</el-form-item>
          </el-col> -->
          <el-col :span="12">
            <el-form-item label="志愿者名称：" prop="ehvName">{{form.ehvName}}</el-form-item>
          </el-col>          
          <el-col :span="12">
            <el-form-item label="身份证：" prop="ehvIdNumber">{{form.ehvIdNumber}}</el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="手机号：" prop="ehvPhone">{{form.ehvPhone}}</el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="所属网格：" prop="ehGridId">{{form.ehGridName}}</el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="所在街道：" prop="ehvStreet">
              {{form.ehvStreet}}
            </el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="详细地址："  prop="ehvAddress">{{form.ehvAddress}}</el-form-item>
          </el-col>
        </el-row>
             <el-row>          
          <el-col :span="12">
            <el-form-item label="所在小区："  prop="ehvQuarters">{{form.ehvQuarters}}</el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="审批人：" prop="ehvAuthUid">{{form.ehvAuthUsername}}</el-form-item>
          </el-col>
          <el-col :span="8">
            <el-form-item label="审批结果："  prop="ehvAuthStatus">{{form.ehvAuthStatus}}</el-form-item>
          </el-col>
          
        <el-row>
          <el-col :span="24">
            <el-form-item label="自我评价：" prop="ehvContent">{{form.ehvContent}}</el-form-item>
          </el-col>
        </el-row>
        </el-row>
             <el-row>
          <el-col :span="24">
            <el-form-item label="审批结果说明：" prop="ehvReson">{{form.ehvReson}}</el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="24">
            <el-form-item label="备注：" prop="ehvMark">{{form.ehvMark}}</el-form-item>
          </el-col>
        </el-row>
        <el-row>
          <el-col :span="12">
            <el-form-item label="审批时间："  prop="ehvAuthTime">{{form.ehvAuthTime}}</el-form-item>
          </el-col>
          <el-col :span="12">
            <el-form-item label="申请时间："  prop="ehvCreateTime">{{form.ehvCreateTime}}</el-form-item>
          </el-col>
        </el-row>
      </el-form>
      <div slot="footer" class="dialog-footer">
        <el-button type="primary" @click="handleQuery">确 定</el-button>
        <el-button @click="cancel">取 消</el-button>
      </div>
    </el-dialog>
  </div>
</template>
<script>
import {
  listEhUserVolunteer,
  getEhUserVolunteer,
  delEhUserVolunteer,
  addEhUserVolunteer,
  updateEhUserVolunteer
} from "@/api/volunteer/ehuservolunteer";
export default {
  name: "EhUserVolunteer",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 选中数组
      ids: [],
      // 非单个禁用
      single: true,
      // 非多个禁用
      multiple: true,
      // 总条数
      total: 0,
      // 岗位表格数据
      ehUserVolunteerList: [],
      // 弹出层标题
      title: "",
      // 是否显示弹出层
      open: false,

      // 查询参数
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        ehvCreateTime: undefined,
        ehvUpdateTime: undefined,
        ehGridId: undefined,
        ehvStreet: undefined,
        ehvPhone: undefined,
        ehvMark: undefined,
        ehvAddress: undefined,
        ehvQuarters: undefined,
        ehvContent: undefined,
        ehvAuthUid: undefined,
        ehvAuthStatus: undefined,
        ehvReson: undefined,
        ehvAuthTime: undefined,
        ehvIdNumber: undefined
      },
      // 表单参数
      form: {}
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询用户申请认证志愿者列表 */
    getList() {
      this.loading = true;
      listEhUserVolunteer(this.queryParams).then(response => {
        this.ehUserVolunteerList = response.data.list;
        this.total = response.data.total;
        this.loading = false;
      });
    },
    // 取消按钮
    cancel() {
      this.open = false;
      this.reset();
    },
    /** 搜索按钮操作 */
    handleQuery() {
      this.queryParams.pageNum = 1;
      this.getList();
    },
    /** 查看按钮操作 */
    handleInfo(row) {
      const ehvId = row.ehvId || this.ids;
      getEhUserVolunteer(ehvId).then(response => {
        this.form = response.data;
        this.open = true;
        this.title = "查看志愿者信息";
      });
    }
  }
};
</script>
